home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 5 / Amiga Plus Sonderheft 1996 #5.iso / programme / imageengineerv3.0 / arexx / halftone.rexx < prev    next >
OS/2 REXX Batch file  |  1986-07-03  |  3KB  |  112 lines

  1. /**********************************/
  2. /* Image Engineer Macro script    */
  3. /* by Simon Edwards               */
  4. /* 3/6/95                         */
  5. /*                                */
  6. /* This lets you select an alpha  */ 
  7. /* channel image to be scaled and */
  8. /* used as a halftone pattern on  */
  9. /* the project.                   */
  10. /**********************************/
  11.  
  12. Options results
  13. signal on error            /* Setup a place for errors to go */
  14.  
  15. if arg()==0 then exit
  16.  
  17. menu=0
  18. done=0
  19. do while done=0
  20. select
  21.     when menu=0 then do
  22.         'REQUEST "Image to use for the halftone" "Spherical|Vertical|Horizontal|More.."'
  23.         reply=RESULT
  24.         select
  25.             when reply=1 then do
  26.                 'OPEN "IE:alpha/Spherical.alpha" 8BIT'
  27.                 alphachannel=result
  28.                 CALL scalealpha
  29.                 done=1
  30.                 end
  31.             when reply=2 then do
  32.                 'OPEN "IE:alpha/Gradient.alpha" 8BIT'
  33.                 alphachannel=result
  34.                 CALL scalealpha
  35.                 done=1
  36.                 end
  37.             when reply=3 then do
  38.                 'OPEN "IE:alpha/Gradient.alpha" 8BIT'
  39.                 alphachannel=result
  40.                 'ROTATE '||alphachannel||' 90 FAST'
  41.                 tmp=result
  42.                 CLOSE alphachannel
  43.                 alphachannel=tmp
  44.                 CALL scalealpha
  45.                 done=1
  46.                 end
  47.             when reply=0 then menu=1
  48.         end
  49.         end
  50.     when menu=1 then do
  51.         'REQUEST "Image to use for the halftone" "Diagonal|Ordered4|Wavey|More.."'
  52.         reply=RESULT
  53.         select
  54.             when reply=1 then do
  55.                 'OPEN "IE:alpha/diagonal.alpha" 8BIT'
  56.                 alphachannel=RESULT
  57.                 CALL scalealpha
  58.                 done=1
  59.                 end
  60.             when reply=2 then do
  61.                 'OPEN "IE:alpha/ordered4.alpha" 8BIT'
  62.                 alphachannel=RESULT
  63.                 done=1
  64.                 end
  65.             when reply=3 then do
  66.                 'OPEN "IE:alpha/wavey.alpha" 8BIT'
  67.                 alphachannel=RESULT
  68.                 CALL scalealpha
  69.                 done=1
  70.                 end
  71.             when reply=0 then menu=0
  72.         end
  73.         end
  74. end
  75. end
  76.  
  77.  
  78. MARK arg(1) PRIMARY
  79. MARK alphachannel ALPHA
  80. HALFTONE
  81. CLOSE alphachannel
  82. exit
  83.  
  84.  
  85. scalealpha:
  86.     'GET_NUMBER "Size in pixels" 4 256 "Ok|Cancel" 16'
  87.     size=result
  88.     SCALE alphachannel size size FAST
  89.     temp=RESULT
  90.     CLOSE alphachannel
  91.     alphachannel=temp
  92.     return
  93.  
  94.  
  95. /*******************************************************************/
  96. /* This is where control goes when an error code is returned by IE */
  97. /* It puts up a message saying what happened and on which line     */
  98. /*******************************************************************/
  99. error:
  100. if RC=5 then do            /* Did the user just cancel us? */
  101.     IE_TO_FRONT
  102.     LAST_ERROR
  103.     'REQUEST "'||RESULT||'"'
  104.     exit
  105. end
  106. else do
  107.     IE_TO_FRONT
  108.     LAST_ERROR
  109.     'REQUEST "Error detected!!!'||D2C(10)||'Image Engineer error message is as follows'||D2C(10)||result||D2C(10)||'Script failed on line '||SIGL||'"' 'Doh!'
  110.     exit
  111. end
  112.